package cn.otrue.patienthealthmanager.activity;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import android.widget.TextView;
import cn.otrue.patienthealthmanager.R;
import cn.otrue.patienthealthmanager.adapter.CenterScoreAdapter;

public class CenterScoreActivity extends BaseActivity {
	private ListView lv_center_score;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_center_score);
		initView();
	}

	public void initView() {
		initTitleBar();
		lv_center_score = (ListView) findViewById(R.id.lv_center_score);
		getData();
		CenterScoreAdapter adapter=new CenterScoreAdapter(this, testData);
		lv_center_score.setAdapter(adapter);
	}

	private void initTitleBar() {
		TextView tv_title_back = (TextView) findViewById(R.id.tv_title_back);
		TextView tv_title_title = (TextView) findViewById(R.id.tv_title_title);
		TextView tv_title_other = (TextView) findViewById(R.id.tv_title_other);
		tv_title_back.setVisibility(View.VISIBLE);
		tv_title_back.setOnClickListener(this);
		tv_title_title.setText(getString(R.string.myscore));
		tv_title_other.setVisibility(View.VISIBLE);
		tv_title_other.setText(getString(R.string.register));
		tv_title_other.setOnClickListener(this);

	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.tv_title_back:
			finish();
			break;

		default:
			break;
		}
	}

	/**
	 * 获取数据
	 */
	private List<Map<String, String>> testData;
	public void getData() {
		testData=new ArrayList<Map<String,String>>();
		Map<String, String> map1=new HashMap<String, String>();
		map1.put("content", "添加运动记录");
		map1.put("score", "（+1积分/次）");
		map1.put("times", "一天一次");
		testData.add(map1);
		Map<String, String> map2=new HashMap<String, String>();
		map1.put("content", "添加血压记录");
		map1.put("score", "（+1积分/次）");
		map1.put("times", "一天一次");
		testData.add(map2);
	}
}
